/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package iplayer;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author stephengalbraith
 */
public class Program {

    public String pid;
    public String name;
    public String series;
    public String episode;
    public String description;
    public String streamURL;
    public String thumbnailURL;
    public String[] modes;
    public String[] modeSizes;
    public String defaultMode;
    public String duration;

    public void compressRawData()
    {
        final List<String> uniqueModes= new ArrayList<String>();
        final List<String> uniqueSizes = new ArrayList<String>();
        if (null==this.modes)
        {
            return;
        }
        for (int i=0;i<this.modes.length;i++)
        {
            if (this.modes[i].equals("flashnormal1")&& !uniqueModes.contains("flashnormal"))
            {
                uniqueModes.add("flashnormal");
                uniqueSizes.add(this.modeSizes[i]);
            }
            else if (this.modes[i].equals("flashnormal2")&& !uniqueModes.contains("flashnormal"))
            {
                uniqueModes.add("flashnormal");
                uniqueSizes.add(this.modeSizes[i]);
            }
            else if (this.modes[i].equals("flashvhigh1")&& !uniqueModes.contains("flashvhigh"))
            {
                uniqueModes.add("flashvhigh");
                uniqueSizes.add(this.modeSizes[i]);
            }
            else if (this.modes[i].equals("flashvhigh2")&& !uniqueModes.contains("flashvhigh"))
            {
                uniqueModes.add("flashvhigh");
                uniqueSizes.add(this.modeSizes[i]);
            }
            else if (this.modes[i].equals("flashhigh1")&& !uniqueModes.contains("flashhigh"))
            {
                uniqueModes.add("flashhigh");
                uniqueSizes.add(this.modeSizes[i]);
            }
            else if (this.modes[i].equals("flashhd1")&& !uniqueModes.contains("flashhd"))
            {
                uniqueModes.add("flashhd");
                uniqueSizes.add(this.modeSizes[i]);
            }
            else if (this.modes[i].equals("flashlow1")&& !uniqueModes.contains("flashlow"))
            {
                uniqueModes.add("flashlow");
                uniqueSizes.add(this.modeSizes[i]);
            }
            else if (this.modes[i].equals("flashlow2")&& !uniqueModes.contains("flashlow"))
            {
                uniqueModes.add("flashlow");
                uniqueSizes.add(this.modeSizes[i]);
            }
        }
        this.modes=uniqueModes.toArray(new String[uniqueModes.size()]);
        this.modeSizes=uniqueSizes.toArray(new String[uniqueSizes.size()]);
    }
}
